$(function(){
	var pageSize = 12, pageNow = 0;
	var divCount = $('#detailList').children('div').length;
	/***/
	function render(pageSize, pageNow) {
		$.ajax({
					'url' : '/expMng/detail.do',
					'contentType' : "application/json",
					'data' : {
						'pageSize' : pageSize,
						'pageNow' : pageNow,
						'keyword': detailKeyword
					},
					success : function(data, textStatus, jqXHR) {
						var pagination = data.pagination;
						$('#detailPagination').pagination({
							'showPageList' : false,
							'total' : pagination.total,
							'displayMsg' : '显示{from} 到 {to} 项，共 {total} 项',
							'pageSize' : pagination.pageSize,
							'pageNumber' : pagination.pageNumber,
							'onSelectPage' : function(pageNumber, pageSize) {
								(pageSize, pageNumber - 1);
							},
							'onRefresh' : function(pageNumber,pageSize) {
								render(pageSize, pageNumber - 1);
							},
							'onChangePageSize' : function(pageNumber, pageSize) {
								render(pageSize, pageNumber - 1);
							}
						});
						var expPkgs = data.pkgImgs;
						$('#detailList').find('div').empty();
						$.each(expPkgs,function(i, v) {
							var name = v.name;
							var path = v.path;
							var mod = i % divCount;
							var imgSpan = '<span class="imgSpanCls">'
								+'<img src="/expressions/'+ path
								+ '"/>'+'</span>';
								$($('#detailList').find('div')[mod]).append(imgSpan);})
						$('#preview > img').attr('src','/expressions/'+expPkgs[0].path);
					}
				});
	}
	$('#detailList').on('click','img',function(){
		console.log("--->img_src:" + $(this).attr('src'));
		$('#preview>img').attr('src',$(this).attr('src'));
	})
	render(pageSize, pageNow);
})